package sklepik;

import java.math.BigDecimal;
import java.math.BigInteger;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import sklepik.modelsklep.Barcode;
import sklepik.modelsklep.Delivelercode;
import sklepik.modelsklep.Producer;

public class ResultRecord {
    protected String namePl;
    protected String shortdescriptionPl;
    protected String descriptionPl;
    protected String seoPl;
    protected Delivelercode delivelercode;
    protected BigInteger ean;
    protected Barcode barcode;
    protected BigDecimal buyprice;
    protected BigDecimal sellprice;
    protected BigInteger stock;
    protected BigDecimal weight;
    protected String photo;
    protected BigDecimal vat;
    protected Producer producer;
    protected String category;
	
	
	
	ResultRecord(String namePl, String descriptionPl, BigInteger stock,BigInteger ean, BigDecimal weight, String photo, String category, BigDecimal buyprice){
		this.namePl=namePl;
		this.descriptionPl=descriptionPl;
		this.stock=stock;
		this.weight=weight;
		this.photo=photo;
		this.category=category;
		this.ean=ean;
		this.buyprice=buyprice;
		
		this.delivelercode=null;
		this.ean=null;
		this.barcode=null;
		this.producer=null;
	}



	public String getNamePl() {
		return namePl;
	}



	public void setNamePl(String namePl) {
		this.namePl = namePl;
	}



	public String getShortdescriptionPl() {
		if (shortdescriptionPl==null){return new String("");}
		return shortdescriptionPl;
	}



	public void setShortdescriptionPl(String shortdescriptionPl) {
		this.shortdescriptionPl = shortdescriptionPl;
	}



	public String getDescriptionPl() {
		return descriptionPl;
	}



	public void setDescriptionPl(String descriptionPl) {
		this.descriptionPl = descriptionPl;
	}



	public String getSeoPl() {
		return seoPl;
	}



	public void setSeoPl(String seoPl) {
		this.seoPl = seoPl;
	}



	public Delivelercode getDelivelercode() {
		return delivelercode;
	}



	public void setDelivelercode(Delivelercode delivelercode) {
		this.delivelercode = delivelercode;
	}



	public BigInteger getEan() {
		return ean;
	}



	public void setEan(BigInteger ean) {
		this.ean = ean;
	}



	public Barcode getBarcode() {
		return barcode;
	}



	public void setBarcode(Barcode barcode) {
		this.barcode = barcode;
	}



	public BigDecimal getBuyprice() {
		if (buyprice==null){return BigDecimal.valueOf(20.00);}
		return buyprice;
	}



	public void setBuyprice(BigDecimal buyprice) {
		this.buyprice = buyprice;
	}



	public BigDecimal getSellprice() {
		
		return this.getBuyprice();
	}



	public void setSellprice(BigDecimal sellprice) {
		this.sellprice = sellprice;
	}



	public BigInteger getStock() {
		return stock;
	}



	public void setStock(BigInteger stock) {
		this.stock = stock;
	}



	public BigDecimal getWeight() {
		return weight;
	}



	public void setWeight(BigDecimal weight) {
		this.weight = weight;
	}



	public String getPhoto() {
		return "petersonstepup-jpg";
		//return photo;
	}



	public void setPhoto(String photo) {
		this.photo = photo;
	}



	public BigDecimal getVat() {
		return vat;
	}

	public String getVatAsString(){
		return new String("23.00");
	}

	public void setVat(BigDecimal vat) {
		this.vat = vat;
	}



	public Producer getProducer() {
		return producer;
	}



	public void setProducer(Producer producer) {
		this.producer = producer;
	}



	public String getCategory() {
		return category;
	}



	public void setCategory(String category) {
		this.category = category;
	}
	
	public String nullCheck(Object valueChecked){
		String result="";
		if (valueChecked==null){
		return result;}
		else return result;
	}
	
	public String toString(){
		
		String result=this.getNamePl()+",<p>"+this.getShortdescriptionPl()+"</p>,<p>"+this.getDescriptionPl()+"</p>,,,,,"+this.getBuyprice()+","+this.getSellprice()+","+this.getStock()+","+this.getWeight()+","+this.getPhoto()+","+this.getVatAsString()+","+this.getCategory()+"\n";
		
		return result;
		
	}
}
